package com.zkj.response;

import java.io.IOException;
import java.util.Random;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 设置浏览器缓存时间
 * 
 * @author zkj
 * 
 */
public class Servlet_Resp_Demo3 extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		/**
		 * 设置浏览器缓存时间
		 * 
		 */
		resp.setContentType("text/html;charset=utf-8");
		resp.setDateHeader("Expires", System.currentTimeMillis() + 1 * 60 * 60
				* 1000);// 时间单位：ms
		System.out.println("缓存");
		resp.getWriter().write("设置缓存时间");

	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		doGet(req, resp);

	}

}
